<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of contexte
 *
 * @author Caroline
 */
class Contexte {
    private $id;
    private $libelle;

    //constructeur
    function __construct($libelle) {
        $this->libelle = $libelle;
    }

    //accesseurs
    public function getId() {
        return $this->id;
    }

    public function getLibelle() {
        return $this->libelle;
    }

    //modificateurs
    public function setLibelle($libelle) {
        $this->libelle = $libelle;
    }
    
    public function setId($id) {
        $this->id = $id;
    }
    
    public function modifierContexte(Bdd $sql){            
        $req = "UPDATE contexte
                WHERE con_id         ='$this->id'
                SET con_libelle      ='$this->libelle';

        $sql->query($req)";
    }  

    public function ajoutContexte(Bdd $sql){        
        $new = "INSERT INTO contexte
                VALUES ('$this->id',
                        '$this->libelle')";

        $sql->query($new);
    } 
    
    public function suprimerContexte(Bdd $sql)
    {        
        $del = "DELETE FROM contexte
                WHERE con_id = '$this->id'";

        $sql->query($del);        
    }
}
?>
